//有效的完全平方数  力扣367
//通过二分查找判断一个数是否是完全平方数
//左闭右闭
class Solution {
public:
	bool isPerfectSquare(int num) {
		int left = 0;
		int right = num;
		while(left <= right)
		{
			long long mid = left + (right - left) / 2;
			if(mid*mid < num) left = mid + 1;
			else if(mid*mid > num) right = mid - 1;
			else return true;
		}
		return false;
	}
};
